package com.ruyuan.o2o.groupbuy.batch.admin.task;

import com.ruyuan.o2o.groupbuy.excel.service.ExcelService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 批处理任务
 *
 * @author ming qian
 */
@Component
@Slf4j
@SuppressWarnings("unused")
public class FixedPrintTask {

    @Reference(version = "1.0.0", interfaceClass = ExcelService.class,
            cluster = "failfast", loadbalance = "roundrobin")
    private ExcelService excelService;

    /**
     * 模拟自动生成报表 每20秒执行一次生成报表任务
     */
    @Scheduled(cron = "*/20 * * * * ?")
    public void execute() {
        excelService.excel();
        log.info("# 已生成报表");
    }

}
